import Vue from 'vue'

import VueRouter from 'vue-router'

Vue.use(VueRouter)

import VueResource from 'vue-resource'

Vue.use(VueResource)


// 1.创建组件
import Home from "../components/home.vue";
import News from "../components/news.vue";


// 2.配置路由
const routers = [
    { path: '/home', component: Home },
    { path: '/news', component: News }
]

// 3.实例化VueRouter
const router = new VueRouter({
    //mode: "history",//默认的hash模式变成history模式，去掉url中乱七八糟的#等符号。
    // routes 
    //缩写，相当于routers: routers
    routes: routers
})

//5 <router-view></router-view> 放在 App.vue

// 6. 暴露路由
export default router;
